<?php
/**
 * 范围奖励查询
 */
namespace app\common\model;

use think\Model;

class RangeReward extends Model
{
    protected $name = 'range_reward';

    /**
     * 列表
     * @param $order
     * @param int $limit
     * @param int $page
     */
    public static function getList($order,$limit = 20,$page = 1,$where=[]){
        $data = self::where($where)->order($order)->paginate(['list_rows'=>$limit,'page'=>$page])->toArray();
        return $data;
    }

    /**
     * 查询所有列表
     * @param $order
     * @param int $limit
     * @param int $page
     */
    public static function getListAll($order = 'min asc',$where=[]){
        $data = self::where($where)->order($order)->select();
        return $data;
    }

    /**
     * 获取详情
     * @param $id   ID
     * @return RangeReward|array|mixed|Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public static function getDetails($id){
        return self::where('id',$id)->find();
    }
}